package com.era.act.news;

import com.opensymphony.xwork2.ActionSupport;
import com.era.dao.NewsInfoDAO;
import com.era.entity.NewsInfo;
import com.era.srv.NewsService;

public class NewsDelete extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int newsId;
	private NewsService newsSer;
	private NewsInfo newsInfo = new NewsInfo();
	public int getNewsId() {
		return newsId;
	}

	public NewsInfo getNewsInfo() {
		return newsInfo;
	}

	public void setNewsInfo(NewsInfo newsInfo) {
		this.newsInfo = newsInfo;
	}

	public void setNewsId(int newsId) {
		this.newsId = newsId;
	}

	public NewsService getNewsSer() {
		return newsSer;
	}

	public void setNewsSer(NewsService newsSer) {
		this.newsSer = newsSer;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println(newsId);
		newsInfo = newsSer.findById(newsId);
		System.out.println(newsInfo.getTitle() + newsInfo.getNewsId());
		newsSer.delete(newsInfo);
		return SUCCESS;
	}
	
	
}
